package com.ewhale.feitengguest.utils.pay;

/**
 * Created by Helen Liu
 * Time :2016/6/21 0021 10:01.
 */

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * 微信回调广播
 */
public class WeiXinPayReceiver extends BroadcastReceiver {

    public static final String WEI_XI_PAY_CALLBACK = "WEI_XI_PAY_CALLBACK";
    public static final String WEI_XI_PAY_CALLBACK_KEY = "WEI_XI_PAY_CALLBACK_KEY";

    private WeiXinPayCallBack weiXinPayCallBack;

    public void setWeiXinPayCallBack(WeiXinPayCallBack weiXinPayCallBack) {
        this.weiXinPayCallBack = weiXinPayCallBack;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent != null) {
            String code = intent.getStringExtra(WeiXinPayReceiver.WEI_XI_PAY_CALLBACK_KEY);
            if (weiXinPayCallBack != null) {
                weiXinPayCallBack.onWXPay(code);
            }
        }
    }
}